<?php
/* @var $this LocationController */
/* @var $model Location */
/* @var $form CActiveForm */

?>
<script type="text/javascript">
function redactor_data()
{
	document.getElementById('summaryFr').value=document.getElementById('Location_summaryFr').value;
	document.getElementById('summaryEn').value=document.getElementById('Location_summaryEn').value;
	document.getElementById('descriptionFr').value=document.getElementById('Location_descriptionFr').value;		
	document.getElementById('descriptionEn').value=document.getElementById('Location_descriptionEn').value;
	document.getElementById('serviceFr').value=document.getElementById('Location_serviceFr').value;
	document.getElementById('serviceEn').value=document.getElementById('Location_serviceEn').value;			
}
</script>

<div class="form">
 <table width="100%" border="0" cellpadding="0" cellspacing="0">
        <tr class="texteSimple">
          <td>&nbsp;</td>
        </tr>
        <tr>
        <?php if ($model->isNewRecord) {?> 
        <td align="center" class="titresIndex">Ajouter une Fiche</td>
        <?php } else { ?>
        <td align="center" class="titresIndex">Modifier une Fiche</td>
        <?php } ?>      
        </tr>
        <tr>
          <td><table width="100%" border="0" cellpadding="10" cellspacing="0" id="pageFooter">
            <tr>
              <td align="center" class="pageDuFooter">
              <table width="100%" border="0" cellpadding="0" cellspacing="5" class="texteSimple">
                <tr>
                  	<td width="287">Numéro de fiche : <?php echo $model->id;?></td>
                 	<td width="702" align="right">Annuler <a href="<?php echo Yii::app()->baseUrl; ?>/backend/?r=location"><img src="<?php echo Yii::app()->baseUrl; ?>/images/icon_delete.png" alt="" width="18" height="18" border="0" align="absmiddle" onClick="MM_popupMsg('Are you sure ?')"></a></td>
                </tr>
                          


<?php $form=$this->beginWidget('CActiveForm', array(
	'id'=>'location-form',
	'enableAjaxValidation'=>false,
	'htmlOptions' => array('enctype' => 'multipart/form-data'),	
)); ?>
   	<tr>
                	<td colspan="2"><?php echo $form->errorSummary($model); ?></td>
                </tr>
                <tr>
                	<td colspan="2"><hr noshade width="100%" color="#CCCCCC" size="1" ></td>
                </tr>

	             <tr>
                 	<td align="right"><?php echo $form->labelEx($model,'id_area'); ?></td>
					<td><?php echo $form->dropDownList($model,'id_area', CHtml::listData(Area::model()->findAll(), 'id', 'name'),							
									array(
									'id'=>'id_area',
									'prompt'=>'Sélectionnez une région',
									'class'=>'searchAAdvanced',
									'ajax' => array(
									'type'=>'POST', 
									'url'=>CController::createUrl('Location/DynamicDepartment'), 
									'update'=>'#id_department',
									'data'=>array('id_area'=>'js:this.value'),
									
									)));
						?>
						<?php echo $form->error($model,'id_area'); ?></td>
				</tr>
	            <tr>
               		<td align="right"><?php echo $form->labelEx($model,'id_department'); ?></td>
               		<td><?php echo $form->dropDownList($model,'id_department', ($model->isNewRecord&&isset($model->idDepartment)) ? array('id_department'=>$model->idDepartment->name) : CHtml::listData(Department::model()->findAll(), 'id', 'name'),array('prompt'=>'Sélectionnez un département','id'=>'id_department','class'=>'searchAAdvanced','options' => array('id_department'=>array('selected'=>true))));?>
						<?php echo $form->error($model,'id_department'); ?>
					</td>
				</tr>
	
	            <tr>
                 	<td align="right"><?php echo $form->labelEx($model,'nameFr'); ?></td>             			 
                 	<td><?php echo $form->textField($model,'nameFr',array('class'=>'searchAAdvanced','size'=>50,'maxlength'=>250)); ?>
						<?php echo $form->error($model,'nameFr'); ?>
					</td>
				</tr>
					
	            <tr>
                 	<td align="right"><?php echo $form->labelEx($model,'nameEn'); ?></td>
                 	<td><?php echo $form->textField($model,'nameEn',array('class'=>'searchAAdvanced','size'=>50,'maxlength'=>250)); ?>
						<?php echo $form->error($model,'nameEn'); ?>
					</td>
				</tr>					
	            <tr>
                 	<td align="right"><?php echo $form->labelEx($model,'adress'); ?></td>
                 	<td><?php echo $form->textField($model,'adress',array('class'=>'searchAAdvanced','size'=>50,'maxlength'=>250)); ?>
						<?php echo $form->error($model,'adress'); ?>
					</td>
				</tr>
	            <tr>
                 	<td align="right"><?php echo $form->labelEx($model,'zip_code'); ?></td>
					<td><?php echo $form->textField($model,'zip_code',array('class'=>'searchAAdvanced','size'=>5,'maxlength'=>6)); ?>
						<?php echo $form->error($model,'zip_code'); ?>
					</td>
				</tr>
	            <tr>
                 	<td align="right"><?php echo $form->labelEx($model,'town'); ?></td>
					<td><?php echo $form->textField($model,'town',array('class'=>'searchAAdvanced','size'=>50,'maxlength'=>250)); ?>
						<?php echo $form->error($model,'town'); ?>
					</td>
				</tr>					
		        <tr>
                 	<td align="right"><?php echo $form->labelEx($model,'contact'); ?></td>
                 	<td><?php echo $form->textField($model,'contact',array('class'=>'searchAAdvanced','size'=>50,'maxlength'=>250)); ?>
						<?php echo $form->error($model,'contact'); ?>
					</td>
				</tr>
		        <tr>
                 	<td align="right"><?php echo $form->labelEx($model,'site'); ?></td>
                 	<td><?php echo $form->textField($model,'site',array('class'=>'searchAAdvanced','size'=>50,'maxlength'=>250)); ?>
						<?php echo $form->error($model,'site'); ?>
					</td>
				</tr>
		        <tr>
                 	<td align="right"><?php echo $form->labelEx($model,'facebook'); ?></td>
                 	<td><?php echo $form->textField($model,'facebook',array('class'=>'searchAAdvanced','size'=>50,'maxlength'=>250)); ?>
						<?php echo $form->error($model,'facebook'); ?>
					</td>
				</tr>				
                <tr>
                  	<td colspan="2" align="right"><hr noshade width="100%" color="#CCCCCC" size="1" ></td>
                </tr>	
	            <tr>
               		<td align="right"><?php echo $form->labelEx($model,'typeList'); ?></td>
               		<td><?php echo $form->dropDownList($model,'id_type', CHtml::listData(Type::model()->findAll(), 'id', 'name'),array('prompt'=>'Nature du lieu...','id'=>'id_type','class'=>'searchAAdvanced',));?>
						<?php echo $form->error($model,'typeList'); ?>
					</td>
				</tr>  
				<tr>
               		<td align="right"><?php echo $form->labelEx($model,'serviceList'); ?></td>               			
               		<td><?php echo $form->CheckBoxList($model,'serviceList',CHtml::listData(Service::model()->findAll(),'id','name'),array('class'=>'searchAAdvanced','separator'=>' '));?>
						<?php echo $form->error($model,'serviceList'); ?>
					</td>
				</tr> 				
				<tr>
               		<td align="right"><?php echo $form->labelEx($model,'eventList'); ?></td>               			
               		<td><?php echo $form->CheckBoxList($model,'eventList',CHtml::listData(Event::model()->findAll(),'id','name'),array('class'=>'searchAAdvanced','separator'=>' '));?>
						<?php echo $form->error($model,'eventList'); ?>
					</td>
				</tr> 			  				          			
	        	<tr>
                 	<td align="right"><?php echo $form->labelEx($model,'capacity'); ?></td>
                 	<td><?php echo $form->textField($model,'capacity',array('class'=>'searchAAdvanced','size'=>5,'maxlength'=>10)); ?>
                 		<?php echo $form->error($model,'capacity'); ?>
                 	</td>
                </tr>
				<tr>
               		<td align="right"><?php echo $form->labelEx($model,'langList'); ?></td>               		
               		<td><?php echo $form->CheckBoxList($model,'langList',CHtml::listData(Lang::model()->findAll(),'id','name'),array('class'=>'searchAAdvanced','separator'=>' ',));?>
						<?php echo $form->error($model,'langList'); ?>
					</td>
				</tr> 	
				<tr>
                  	<td colspan="2" align="right"><hr noshade width="100%" color="#CCCCCC" size="1" ></td>
                </tr>	
                
	        	<tr>
                 	<td align="right"><?php echo $form->labelEx($model,'summaryFr'); ?></td>               	
                 	<td><?php echo $form->textArea($model, 'summaryFr', array('style'=>'display:none','id' => 'summaryFr')); ?>
                 		<?php $this->widget('ext.widgets.redactorjs.Redactor', array(
                 											'editorOptions' => array(
                 											'autoresize' => false,
                 											'fixed' => false),
                 											'height'=>'70px',
                 											'width'=>'400px',
                 											'htmlOptions'=>array(
            												'onClic'=>'alert(\'test\';',
                 											'class'=>'searchAAdvanced',
                 											),
                 											'toolbar' => 'mini',
                 											'lang'=>'fr',
                 											'model' => $model,
                 											'attribute' => 'summaryFr',)
                 							);?>                  	
                 		<?php echo $form->error($model,'summaryFr'); ?>
                 	</td>
                </tr>   
                
	        	<tr>
                 	<td align="right"><?php echo $form->labelEx($model,'summaryEn'); ?></td>
                 	<td><?php echo $form->textArea($model, 'summaryEn', array('style'=>'display:none','id' => 'summaryEn')); ?>
                 		<?php $this->widget('ext.widgets.redactorjs.Redactor', array(
                 											'editorOptions' => array(
                 											'autoresize' => false,
                 											'fixed' => false),
                 											'height'=>'70px',
                 											'width'=>'400px',
                 											'htmlOptions'=>array(
            												
                 											'class'=>'searchAAdvanced',
                 											),
                 											'toolbar' => 'mini',
                 											'lang'=>'fr',
                 											'model' => $model,
                 											'attribute' => 'summaryEn',)
                 							);?> 
                 		<?php echo $form->error($model,'summaryEn'); ?>
                 	</td>
                </tr>    
                                 
	        	<tr>
                 	<td align="right"><?php echo $form->labelEx($model,'descriptionFr'); ?></td>
                 	<td><?php echo $form->textArea($model, 'descriptionFr', array('style'=>'display:none','id' => 'descriptionFr')); ?>
                 		<?php $this->widget('ext.widgets.redactorjs.Redactor', array(
                 											'editorOptions' => array(
                 											'autoresize' => false,
                 											'fixed' => false),
                 											'height'=>'70px',
                 											'width'=>'400px',
                 											'htmlOptions'=>array(
            												
                 											'class'=>'searchAAdvanced',
                 											),
                 											'toolbar' => 'mini',
                 											'lang'=>'fr',
                 											'model' => $model,
                 											'attribute' => 'descriptionFr',)
                 							);?> 
                 		<?php echo $form->error($model,'descriptionFr'); ?>
                 	</td>
                </tr> 
	        	<tr>
                 	<td align="right">
                 	<?php echo $form->labelEx($model,'descriptionEn'); ?></td>
                 	<td>
                 	<?php echo $form->textArea($model, 'descriptionEn', array('style'=>'display:none','id' => 'descriptionEn')); ?>
                 	<?php $this->widget('ext.widgets.redactorjs.Redactor', array(
                 											'editorOptions' => array(
                 											'autoresize' => false,
                 											'fixed' => false),
                 											'height'=>'70px',
                 											'width'=>'400px',
                 											'htmlOptions'=>array(
            												
                 											'class'=>'searchAAdvanced',
                 											),
                 											'toolbar' => 'mini',
                 											'lang'=>'fr',
                 											'model' => $model,
                 											'attribute' => 'descriptionEn',)
                 							);?>                  	
                 		<?php echo $form->error($model,'descriptionEn'); ?>
                 	</td>
                </tr>                 
	        	<tr>
                 	<td align="right"><?php echo $form->labelEx($model,'serviceFr'); ?></td>
                 	<td><?php echo $form->textArea($model, 'serviceFr', array('style'=>'display:none','id' => 'serviceFr')); ?>
                 		<?php $this->widget('ext.widgets.redactorjs.Redactor', array(
                 											'editorOptions' => array(
                 											'autoresize' => false,
                 											'fixed' => false),
                 											'height'=>'70px',
                 											'width'=>'400px',
                 											'htmlOptions'=>array(
            												
                 											'class'=>'searchAAdvanced',
                 											),
                 											'toolbar' => 'mini',
                 											'lang'=>'fr',
                 											'model' => $model,
                 											'attribute' => 'serviceFr',)
                 							);?>   
                 		<?php echo $form->error($model,'serviceFr'); ?>
                 	</td>
                </tr>
                <tr>
                 	<td align="right"><?php echo $form->labelEx($model,'serviceEn'); ?></td>
                 	<td><?php echo $form->textArea($model, 'serviceEn', array('style'=>'display:none','id' => 'serviceEn')); ?>
                 		<?php $this->widget('ext.widgets.redactorjs.Redactor', array(
                 											'editorOptions' => array(
                 											'autoresize' => false,
                 											'fixed' => false),
                 											'height'=>'70px',
                 											'width'=>'400px',
                 											'htmlOptions'=>array(
            												
                 											'class'=>'searchAAdvanced',
                 											),
                 											'toolbar' => 'mini',
                 											'lang'=>'fr',
                 											'model' => $model,
                 											'attribute' => 'serviceEn',)
                 							);?>                    	
                 		<?php echo $form->error($model,'serviceEn'); ?>
                 	</td>
                </tr>   
		        <tr>
                 	<td align="right"><?php echo $form->labelEx($model,'pdf'); ?></td>
                 	<td><?php echo CHtml::activeFileField($model, 'pdf',array('class'=>'searchAAdvanced')); ?>
   						<?php echo $form->error($model,'pdf'); ?>
					</td>
				</tr>
				<?php 
 					$this->renderPartial('_form_pdf',array(
 					'model'=>$model,
 					)); 
				?>
		        <tr>
		        	<td>&nbsp;</td>
                 	<td align="left"><?php echo CHtml::submitButton($model->isNewRecord ? 'Enregistrer' : 'Sauvegarder',array('OnClick'=>'redactor_data()','class'=>'searchAAdvanced')); ?></td>
                </tr>			
									
<?php $this->endWidget(); ?>

				<?php if (!$model->isNewRecord) {   		 			    		
    				$model->isNewRecord ? '' :
 					$this->renderPartial('_form_image',array(
 					'model'=>$model,
 					)); 
				}
              	?>
</div><!-- form -->